import "./mock";
import Vue from "vue";
import App from "./App.vue";
import "./styles/global.less";
import router from "./router";
import showMessage from "./Utils/showMessage";
import "./eventBus";
import store from "./store"
store.dispatch("setting/fetchSetting")
//import getComponentRootDom from "./Utils/getComponentRootDom";
//import Home from "./views/Home"
//向Vue原型中添加 showMessage 方法
Vue.prototype.$showMessage = showMessage;
//Vue.prototype.$getComponentRootDom = getComponentRootDom;

import vloading from "./directives/loading"
import vLazy from "./directives/lazy"
Vue.directive("loading", vloading)
Vue.directive("lazy", vLazy)

new Vue({
  router,
  store,
  render: h => h(App),
}).$mount('#app')

//博客测试代码开始 测试给服务端发送请求

// import * as blogApi from "./api/blog";

// blogApi.getBlogCategories().then((r) => {
//   console.log("博客分类我在main.js", r);
// });

// blogApi.getBlogs(2, 20, 3).then((r) => {
//   // console.log("博客", r);
// });

// blogApi.getBlog("fawjd81").then((r) => {
//   console.log(r);
// })

// blogApi.postComment({
//   nickname: "昵称",
//   content: "评论内容，纯文本",
//   blogId: "111"
// }).then((r) => {
//   console.log(r);
// })

// blogApi.getcomments("我是个id", "1", "10").then((r) => {
//   console.log(r);
// })